package com.example.aggregatedemo.arrary;

import com.example.aggregatedemo.arrary.a05mySet.Student;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashSet;
import java.util.LinkedHashSet;

@SpringBootTest
public class LinkedHashSetTest_1 {

    @Test
    void DemoTest1() {
        //对象成员值相同，我们认为是一个队形
        Student s1 = new Student("z113", 21);
        Student s2 = new Student("z114", 21);
        Student s3 = new Student("w5", 21);
        Student s4 = new Student("z6", 23);

        HashSet<Student> hs = new HashSet<>();
        System.out.println(hs.add(s1));
        System.out.println(hs.add(s2));
        System.out.println(hs.add(s3));
        System.out.println(hs.add(s4));
        System.out.println(hs);

        System.out.println("---LinkedHashSet---");
        LinkedHashSet<Student> lh = new LinkedHashSet<>();
        lh.add(s1);
        lh.add(s2);
        lh.add(s3);
        lh.add(s4);
        System.out.println(lh);


    }

    @Test
    void DemoTest2() {

    }

}
